<div class="row row-cards row-deck">
  <div class="col-12">
    <div class="card">
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th class="text-center w-1"><i class="icon-people"></i></th>
            <th>商品名字</th>
            <th>SKU编码</th>
            <th>成本价</th>
            <th>销售价</th>
            <th>促销价</th>
            <th>库存</th>
            <th>拥有属性</th>
            <th class="text-center">
              <a href="<%= new_shop_spu_sku_path(@spu) %>">新增属性</a>
            </th>
          </tr>
        </thead>
        <tbody>
          <% @skus.each do |sku| %>
            <tr>
              <td class="text-center">
                <div class="avatar d-block" style="background-image: url(<%= sku.avatar.url %>)">
                  <span class="avatar-status bg-green"></span>
                </div>
              </td>
              <td>
                <div><%= @spu.name %></div>
              </td>
              <td>
                <div><%= sku.name %></div>
              </td>
              <td>
                <div><%= sku.cost_price %></div>
              </td>
              <td>
                <div><%= sku.sale_price %></div>
              </td>
              <td>
                <div><%= sku.promotion_price %></div>
              </td>
              <td>
                <div><%= sku.on_hand_count %></div>
              </td>
              <td>
                <% sku.option_values.each do |option_value| %>
                  <%= option_value.presentation %>、
                <% end %>
              </td>
              <td class="text-center">
                <div class="item-action dropdown">
                  <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                  <div class="dropdown-menu dropdown-menu-right">
                    <a href="<%= edit_shop_spu_sku_path(@spu, sku) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
                    <%= link_to shop_spu_sku_path(@spu, sku), method: :delete, class: 'dropdown-item' do %>
                      <i class="dropdown-icon fe fe-edit-2"></i> 删除 
                    <% end %>
                  </div>
                </div>
              </td>
            </tr>
          <% end %>
        </tbody>
      </table>
      <div class="card-footer">
        <%= paginate @skus %>
      </div>
    </div>
  </div>
</div>